<template>
    <div class="shop-edit padding-top" style=" position: relative">
        <el-drawer
			title="打款单明细"
            :before-close="handleClose"
            :visible.sync="show_dialog"
            direction="rtl"
			      size="60%"
            custom-class="demo-drawer"
            ref="drawer"
        >
            <div class="demo-drawer__content"  >
              <span class="time-range-label">2017-10-19至2017-10-19打款包</span><span class="time-range-label">2017-10-19至2017-10-19打款包</span><span class="time-range-label">2017-10-19至2017-10-19打款包</span>

              <el-table :data="groupList" border :height="oHeight">
                <el-table-column
                        align="center"
                        prop="store_id"
                        label="铺id"
                        min-width="60"></el-table-column>
                <el-table-column
                        align="center"
                        prop="bank_AccNo"
                        label="打款账号"
                        min-width="120"></el-table-column>
                <el-table-column
                        align="center"
                        prop="money"
                        label="打款金额"
						min-width="120"></el-table-column>
						
          
                <el-table-column
                        align="center"
                        prop="store_name"
                        label="店铺名称"
                        min-width="90">
                  
                </el-table-column>
                <el-table-column
						align="center"
						prop="store_owner"
                        label="账号名称"
                        min-width="90">
                    
				</el-table-column>
				<el-table-column
				align="center"
				prop="msg"
				label="交易状态"
				min-width="120">
			</el-table-column>
		
			<el-table-column
				align="center"
				prop="error_code"
				label="错误代码"
				min-width="120">
			</el-table-column>
            </el-table>
                <div class="demo-drawer__footer">
                    <el-button @click="cancelForm">取 消</el-button>
                    <el-button
                        type="primary"
                        @click="$refs.drawer.closeDrawer()"
                        :loading="loading"
                        >{{ loading ? "提交中 ..." : "确 定" }}</el-button
                    >
                </div>
            </div>
        </el-drawer>
    </div>
</template>
<script>
    import Tinymce from '@/components/Tinymce';
    import { nc_a } from "@/common/js/area_array.js";
import { resize } from "@/common/js/height.js";
export default {
    data() {
        
        return {
          groupList: [],

          item_data:"",
            group: [
					
					
				],levelList: [
					
					
				],
        oHeight: 800,
            uploadData:{
				img_source:'attach_editor'
			},
            loading: false,
           
        formLabelWidth: '80px',
			timer: null,
			show_dialog:false,
			type:'add'
        };
    },
    components: {Tinymce},
	created(){
    this.uploadData={};
        
		console.log('created',this)
	},
    methods: {
        getdata() {
          const data = {};
				data.id = this.item_data;
        // console.log()
				this.$http.post('/admin/bill/index.php?act=reconciliation&op=detail', data).then(res => {
					if (res.code == 1) {
            this.groupList = res.data.list.map(function(item) {
								return {
									store_id: item.store_id,
									bank_AccNo: item.bank_AccNo,
									money: item.money,
									store_name:item.store_name,
									store_owner:item.store_owner,
									msg:item.msg,
									error_code:item.error_code,				
								}
							});

					} else {
						this.groupList = [];
						 alert(res.msg)
					}
				})
			},
       
		show_dialog_fn(data){
			if(data){
				this.item_data = data;
        console.log(this.item_data);
        this.getdata();
				// this.type = 'edit'
			}
			this.show_dialog = true;
		},
        handleClose(done) {
		//done 用于关闭 Drawer
        if (this.loading) {
                return;
            }
            this.$confirm('确定要提交表单吗？')
                .then(_ => {
                    this.loading = true;
                    this.$refs.ruleForm.validate(valid => {
                     if (valid) {  
                       for(let i=0;i<this.group.length;i++){
                           if(this.group[i].id==this.form.project_class_id){
                                 this.form.project_class_name=this.group[i].project_class_name;
                                 }
                       }
                       this.$http
                      .post(
                       "/admin/platform_coupon/index.php?act=platform_coupon&op=add_coupon",
                       this.form
                     )
            .then(res => {
              if (res.code == 1) {

                this.$parent.getListData();
                
              } else {
                  alert(res.msg);
                  
              }
            });
           
             
          
          }
           });

                    this.timer = setTimeout(() => {

                        done();
                         
                        // 动画关闭需要一定的时间
                        setTimeout(() => {
                            this.loading = false;
                        }, 400);
                    }, 2000);
                })
                .catch(_ => { });
            },
        
                        
               
        
        cancelForm() {
            this.loading = false;
			this.show_dialog = false;
            clearTimeout(this.timer);
        }
    }
};
</script>
<style rel="stylesheet/scss" lang="scss">
    .el-drawer.rtl{
 
    overflow: scroll
    }
    .shop-edit {
  .el-input,
  .el-select,
  .el-cascader,
  .el-textarea {
    width: 220px;
  }
}
</style>
<style lang="scss" scoped>
.el-drawer{
    overflow: scroll;
}
.demo-ruleForm{
  padding-left: 2%;
}
.shop-edit {
  .el-input,
  .el-select,
  .el-cascader,
  .el-textarea {
    width: 220px;
  }
}
</style>